package com.cencus.service.impl;

import com.cencus.dao.TagDao;
import com.cencus.domain.Tag;
import com.cencus.service.TagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TagServiceImpl implements TagService {
    @Autowired
    private TagDao tagDao;

    @Override
    public List<Tag> getAllTags() {
        return tagDao.selectList(null);
    }

    @Override
    public Tag searchTag(String name) {
        return null;
    }

    @Override
    public boolean createTag(String name) {
        Tag tag = new Tag();
        tag.setName(name);
        return tagDao.insert(tag)>0;
    }

    @Override
    public boolean deleteTag(Integer tagId) {
        return tagDao.deleteById(tagId)>0;
    }

    @Override
    public boolean associated(Integer recordId, List<Tag> tags) {
        return false;
    }
}


